import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:motion_toast/motion_toast.dart';
import 'package:motion_toast/resources/arrays.dart';
import 'package:nine_grid_view/nine_grid_view.dart';
import 'package:nylo_framework/nylo_framework.dart';

import '../../bootstrap/helpers.dart';
import 'image_widget.dart';

class PutPaper extends StatefulWidget {
  
  PutPaper({Key? key}) : super(key: key);
  
  static String state = "put_paper";

  @override
  _PutPaperState createState() => _PutPaperState();
}

class _PutPaperState extends NyState<PutPaper> {
  List<String> imageList = [
    "https://globalimg.sucai999.com/preimg/DBC456/700/DBC456/149/88ca6bd4e3af57dd339becd4d25caa1d.jpg",
    "https://globalimg.sucai999.com/preimg/DBC456/700/DBC456/105/cac32b0c2bf8940fc53ac9035d591b4.jpg",
  ];

  _PutPaperState() {
    stateName = PutPaper.state;
  }

  @override
  init() async {
    super.init();
    
  }
  
  @override
  stateUpdated(dynamic data) async {
    // e.g. to update this state from another class
    // updateState(PutPaper.state, data: "example payload");
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Container(
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(10.w),
              border: Border.all(
                width: 4.w,
                color: ThemeColor.get(context)
                    .primaryBackgroundLight
                    .withOpacity(0.5),
              ),
            ),
            padding:
            EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w),
            child: Column(
              children: [
                Row(
                  children: [
                    CircleAvatar(
                      radius: 35.sp, // 头像半径
                      backgroundImage: NetworkImage(
                          'https://globalimg.sucai999.com/preimg/DBC456/700/DBC456/194/384e96d66d7ce4fe7ef7488234fddfc.jpg'), // 头像图片
                    ),
                    SizedBox(
                      width: 20.w,
                    ),
                    Text(
                      "2023-8-3",
                      style: TextStyle(),
                    )
                  ],
                ),
                Divider(
                  thickness: 0.4.w, // 线条粗细
                  indent: 10.w, // 左侧缩进
                  endIndent: 10.w, // 右侧缩进
                  color: ThemeColor.get(context).fontGrey, // 线条颜色
                ),
                Container(
                  child: Text(
                    "不得不承认，年龄越大 ，性格就越简单，更喜欢安静，不喜欢去了解别人，也不想被了解，只想静静的做自己喜欢的事。享受了工作带来的薪酬与成长，就要接纳工作带来的辛苦与忙碌，每一刻疲劳的瞬间，我想的都是好好赚钱好好生活。",
                    style: TextStyle(fontSize: 30.sp),
                    maxLines: 3,
                    overflow: TextOverflow.ellipsis,
                  ),
                ),
                NineGridView(
                  width: MediaQuery.of(context).size.width - 32,
                  padding: EdgeInsets.all(4.0),
                  itemCount: imageList.length,
                  type: NineGridType.weiBo,
                  itemBuilder: (BuildContext context, int index) {
                    // 添加图片按钮
                    return ImageWidget(
                      imageUrl: imageList[index],
                      width: 50.w,
                      height: 50.w,
                    );
                  },
                ),
                Divider(
                  thickness: 0.4.w, // 线条粗细
                  indent: 10.w, // 左侧缩进
                  endIndent: 10.w, // 右侧缩进
                  color: ThemeColor.get(context).fontGrey, // 线条颜色
                ),
                Container(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          Container(
                            width: 120.w,
                            child: Text(
                              "微信号: ",
                              style: TextStyle(fontSize: 30.sp),
                            ),
                          ),
                          Text(
                            "18615019772",
                            style: TextStyle(fontSize: 30.sp),
                          )
                        ],
                      ),
                      GestureDetector(
                          onTap: () {
                            Clipboard.setData(
                                ClipboardData(text: "18615019772"));

                            MotionToast.success(
                              description: Text("已复制到剪贴板"),
                              position: MotionToastPosition.top,
                              animationType: AnimationType.fromTop,
                              animationCurve:
                              Curves.fastEaseInToSlowEaseOut,
                            ).show(context);
                          },
                          child: Text(
                            "复制",
                            style: TextStyle(
                                fontSize: 30.sp,
                                color: ThemeColor.get(context)
                                    .primaryBackgroundDeep
                                    .withOpacity(1)),
                          )),
                    ],
                  ),
                ),
                SizedBox(
                  height: 20.w,
                ),
                Container(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          Container(
                            width: 120.w,
                            child: Text(
                              "QQ号: ",
                              style: TextStyle(fontSize: 30.sp),
                            ),
                          ),
                          Text(
                            "18615019772",
                            style: TextStyle(fontSize: 30.sp),
                          )
                        ],
                      ),
                      GestureDetector(
                          onTap: () {
                            Clipboard.setData(
                                ClipboardData(text: "18615019772"));

                            MotionToast.success(
                              description: Text("已复制到剪贴板"),
                              position: MotionToastPosition.top,
                              animationType: AnimationType.fromTop,
                              animationCurve:
                              Curves.fastEaseInToSlowEaseOut,
                            ).show(context);
                          },
                          child: Text(
                            "复制",
                            style: TextStyle(
                                fontSize: 30.sp,
                                color: ThemeColor.get(context)
                                    .primaryBackgroundDeep
                                    .withOpacity(1)),
                          )),
                    ],
                  ),
                ),
                SizedBox(
                  height: 20.w,
                ),
             /*   Container(
                    child: Column(
                      children: [
                        Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            "审核失败",
                            style: TextStyle(
                                color: Colors.redAccent, fontSize: 30.sp),
                          ),
                        ),
                        Container(
                          child: Text(
                            "交朋友不是供菩萨，和谁舒服就和谁在一起。",
                            style: TextStyle(
                              fontSize: 28.sp,
                            ),
                          ),
                        ),
                        SizedBox(height: 10.w,),
                        Container(
                          alignment: Alignment.centerRight,
                          child: Container(
                            padding: EdgeInsets.symmetric(vertical: 10.w,horizontal: 30.w),
                            decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(10.w),
                                color: ThemeColor.get(context).primaryBackgroundLight
                            ),
                            child: Text(
                              "编辑",
                              style: TextStyle(
                                  fontSize: 30.sp,
                                  color: ThemeColor.get(context).background),
                            ),
                          ),
                        )
                      ],
                    )),*/
            /*    Container(
                  alignment: Alignment.centerLeft,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Container(
                        child: Text(
                          "审核中...",
                          style: TextStyle(
                              color: ThemeColor.get(context).fontGrey, fontSize: 30.sp),
                        ),
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(vertical: 10.w,horizontal: 30.w),
                        decoration: BoxDecoration(
                            borderRadius: BorderRadius.circular(10.w),
                            color: ThemeColor.get(context).primaryBackgroundLight
                        ),
                        child: Text(
                          "撤回",
                          style: TextStyle(
                              fontSize: 30.sp,
                              color: ThemeColor.get(context).background),
                        ),
                      )
                    ],
                  ),
                ),*/
                Container(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Container(
                        child: Text(
                          "已被10人抽到",
                          style: TextStyle(
                              color: ThemeColor.get(context).fontGrey, fontSize: 30.sp),
                        ),
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(vertical: 10.w,horizontal: 30.w),
                        decoration: BoxDecoration(
                            borderRadius: BorderRadius.circular(10.w),
                            color: ThemeColor.get(context).primaryBackgroundLight
                        ),
                        child: Text(
                          "销毁",
                          style: TextStyle(
                              fontSize: 30.sp,
                              color: ThemeColor.get(context).background),
                        ),
                      )
                    ],
                  ),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}
